home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Rectangle;
- import java.io.DataInputStream;
-
- public class CWidgitAction extends CDisplayAction {
- static final int CYCLE_AUTO = 1;
- static final int CYCLE_COUNT = 2;
- protected CWidgitList m_WidgitList = new CWidgitList();
- protected CVarOrValue m_vvPlaySpeed = new CVarOrValue();
- protected int m_nPlayCount;
- protected int m_nFlags;
- private int m_nLoopCounter;
- private int m_lTime;
- private long m_lNextStepTime;
-
- boolean DoAction() {
- boolean var1 = false;
- this.FreeObject();
- Dimension var2 = this.m_WidgitList.Load();
- if (this.m_WidgitList.GetLoadCount() > 0) {
- this.m_lTime = 10 * this.m_vvPlaySpeed.GetValue();
- CRect var3 = new CRect(((CDisplayAction)this).GetActualRect());
- var3.width = Math.min(var3.width, var2.width);
- var3.height = Math.min(var3.height, var2.height);
- if (!((Rectangle)var3).equals(((CDisplayAction)this).GetDrawRect())) {
- if (!((CDisplayAction)this).GetDrawRect().isEmpty()) {
- Globals.thePresView.InvalidateOffScreenRect(((CDisplayAction)this).GetDrawRect());
- }
-
- ((CDisplayAction)this).SetDrawRect(var3);
- var1 = true;
- }
- }
-
- CDrawObj var4 = Globals.thePresView.AddDrawObject((CIconObject)this, 0, var1);
- if (var4 != null) {
- Globals.theAnimThread.AddAnimObject(var4);
- }
-
- return true;
- }
-
- void DrawObject(Graphics var1, int var2, CRect var3) {
- this.m_WidgitList.Draw(var1, var3);
- }
-
- boolean LoadFromFile(DataInputStream var1) {
- this.m_nFlags = FileLoad.ReadCPlusInt(var1);
- this.m_nPlayCount = FileLoad.ReadCPlusInt(var1);
- this.m_vvPlaySpeed.LoadFromFile(var1);
- this.m_WidgitList.LoadFromFile(var1);
- return super.LoadFromFile(var1);
- }
-
- void FreeObject() {
- this.m_nLoopCounter = 0;
- this.m_lTime = 0;
- this.m_lNextStepTime = 0L;
- }
-
- boolean DoAnimation(CRect var1, long var2) {
- boolean var4 = this.m_lTime != 0;
- if (this.m_lTime != 0 && this.m_lNextStepTime <= System.currentTimeMillis() && var1 != null) {
- if (this.m_lNextStepTime == 0L) {
- this.m_lNextStepTime = Globals.theAnimThread.GetLoopStartTime() + (long)this.m_lTime;
- } else {
- this.m_lNextStepTime += (long)this.m_lTime;
- }
-
- if (this.m_WidgitList.Increment()) {
- ++this.m_nLoopCounter;
- if ((this.m_nFlags & 2) != 0 && this.m_nLoopCounter >= this.m_nPlayCount) {
- this.m_lTime = 0;
- var4 = false;
- }
- }
-
- if (this.m_lTime != 0) {
- CRect var5 = new CRect(var1);
- Globals.thePresView.Render(var5);
- Globals.thePresView.Draw((Graphics)null, var5);
- }
- }
-
- return var4;
- }
-
- public CWidgitAction() {
- super(28);
- ((CDisplayAction)this).SetZOrder((short)4);
- }
- }
-